# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
pkgname=py3-kubernetes
_pkgname=kubernetes
pkgver=24.2.0
pkgrel=0
pkgdesc="Official Python client library for kubernetes"
url="https://github.com/kubernetes-client/python"
arch="noarch"
license="Apache-2.0"
depends="py3-certifi py3-dateutil py3-google-auth py3-requests
	py3-requests-oauthlib py3-six py3-urllib3
	py3-websocket-client py3-yaml"
makedepends="py3-build py3-installer py3-wheel"
checkdepends="pytest py3-mock"
source="$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/k/kubernetes/kubernetes-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	# XXX: hack for poetry to not ignore files
	GIT_DIR=. python3 -m build --no-isolation --wheel
}

check() {
	python3 -m installer -d testenv \
		dist/kubernetes-$pkgver-py3-none-any.whl
	local sitedir="$(python3 -c 'import site;print(site.getsitepackages()[0])')"
	# deselected tests have missing modules
	PYTHONPATH="$PWD/testenv/$sitedir" python3 -m \
	pytest --ignore=kubernetes/dynamic/test_client.py \
		--ignore=kubernetes/dynamic/test_discovery.py \
		--ignore=kubernetes/e2e_test \
		kubernetes
}

package() {
	python3 -m installer -d "$pkgdir" \
		dist/kubernetes-$pkgver-py3-none-any.whl
}

sha512sums="
95877b97f5d8c2dc80678561f4202aa40a9e995c0311c2a8596665995b3f77f95478d33e87009c938d14c0243c4ded4cdd4d2f24d1d2a4da3fb93f5e9d6d0e68  py3-kubernetes-24.2.0.tar.gz
"
